# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        Young  
# Name:         join
# Description:
# Author:       asus
# Date:         2019/2/28
#-------------------------------------------------------------------------------


list = ['1','2','3','4','5']
s = "*"
print(s.join(list))


list = ['a','b','c','d','e']
s = "+"
#连接s和list
print(s.join(list))

#用逗号运算符指定路径的每一部分
dirs = '','usr','local','nginx',''


#使用join生成Linux格式的路径
linuxPath = '/'.join(dirs)
print(linuxPath)


#使用join生成windows格式的路径
windowsPath = 'C:' + '\\'.join(dirs)
print(windowsPath)

#PS:与字符串连接的的序列元素必须是字符串类型，如果是其他数据类型，会抛出异常